<?php
/**
 * File containing the ResetManager
 *
 * PHP Version 5
 *
 * @category Manager
 * @package  Manager
 * @author   Martin Schlecht <herrlollinger@gmail.com>
 * @license  MIT License
 * @link     http://code.google.com/p/universal-test-data
 */

/**
 * Manager class "ResetManager"
 *
 * Manager which is used to manage the tags which should be resetted in the session.
 *
 * @category   Processors
 * @package    Processors
 * @subpackage IncrementProcessors
 * @author     Martin Schlecht <herrlollinger@gmail.com>
 * @copyright  see @author
 * @license    MIT License
 * @link       http://code.google.com/p/universal-test-data
 *
 * The followings are the available attributes of the processor class
 * @property array $tegs, the list of tags to manage
 */
class ResetManager
{
	private $tags = array();
	
	/**
	 * Add new entry to the list
	 * .
	 * @param $string
	 */
	public function add($string)
	{
		$this->tags[] = $string;
	}
	
	/**
	 * Cleanup session and reset manager entries
	 */
	public function cleanUp()
	{
		foreach ($this->tags AS $tag) {
			unset(Yii::app()->session[$tag]);
		}
		
		$this->reset();
	}
	
	/**
	 * Reset reset manager
	 */
	public function reset()
	{
		$this->tags = array();
	}
}